//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.rightin.reader.hf.myhf;

import com.rightin.reader.hf.CommunicatorStruct;
import com.rightin.reader.hf.Crc16New;
import com.rightin.reader.hf.DoorCommunicatorStruct;
import com.rightin.reader.hf.rfidenum.EnumBaudRate;
import com.rightin.reader.hf.rfidenum.EnumReaderADDL;
import com.rightin.reader.hf.rfidenum.EnumRfidCommand;
import com.rightin.reader.hf.rfidenum.EnumScanMode;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;

public class HfCommon {
    private static ArrayList<Byte> byteList = new ArrayList();
    private static byte[] DEFAULT_HEAD = new byte[]{-35, 17, -17};
    public static int _reader_address = 0;

    public HfCommon() {
    }

    public static String toHexString2Format(byte[] bytes, String format) {
        String ret = "";
        byte[] var3 = bytes;
        int var4 = bytes.length;

        for(int var5 = 0; var5 < var4; ++var5) {
            byte mybyte = var3[var5];
            ret = ret + String.format("%02X", mybyte) + format;
        }

        ret = ret.substring(0, ret.length());
        return ret;
    }

    public static byte[] hexString2Bytes(String hex_value) {
        int ilen = hex_value.length() / 2;
        byte[] myBytes = new byte[ilen];

        for(int i = 0; i < ilen; ++i) {
            myBytes[i] = (byte)Integer.parseInt(hex_value.substring(i * 2, i * 2 + 2), 16);
        }

        return myBytes;
    }

    public static String bytes2String(byte[] bytes) {
        String sret = "";

        try {
            try {
                sret = new String(bytes, 0, bytes.length, "gbk");
            } catch (UnsupportedEncodingException var6) {
                var6.printStackTrace();
            }

            return sret;
        } finally {
            ;
        }
    }

    public static String bytes2String(byte[] bytes, String code_name) {
        String sret = "";

        try {
            try {
                sret = new String(bytes, 0, bytes.length, code_name);
            } catch (UnsupportedEncodingException var7) {
                var7.printStackTrace();
            }

            return sret;
        } finally {
            ;
        }
    }

    public static byte[] string2Bytes(String str) {
        byte[] msgBuffer = null;

        try {
            try {
                msgBuffer = str.getBytes("GB2312");
            } catch (Exception var6) {
                var6.printStackTrace();
            }

            return msgBuffer;
        } finally {
            ;
        }
    }

    public static byte[] string2Bytes(String str, String code_name) {
        byte[] msgBuffer = null;

        try {
            try {
                msgBuffer = str.getBytes(code_name);
            } catch (Exception var7) {
                var7.printStackTrace();
            }

            return msgBuffer;
        } finally {
            ;
        }
    }

    public static byte[] readBytes(byte[] respose, int index, int length) {
        byte[] revs = new byte[length];

        for(int i = 0; i < length; ++i) {
            revs[i] = respose[index + i];
        }

        return revs;
    }

    public static String getZeros(int icount) {
        byte[] request = new byte[icount];

        for(int i = 0; i < request.length; ++i) {
            request[i] = 0;
        }

        return bytes2String(request);
    }

    public static int convertInteger(byte[] bytes) {
        String hex = toHexString2Format(bytes, "");
        return Integer.parseInt(hex, 16);
    }

    public static short convertUShort(byte[] bytes) {
        String hex = toHexString2Format(bytes, "");
        return Short.parseShort(hex, 16);
    }

    public static byte[] convertBytes(int i) {
        String hex = String.format("%04X", i);
        return hexString2Bytes(hex);
    }

    public static byte[] convertBytes2(short i) {
        String hex = String.format("%04X", i);
        return hexString2Bytes(hex);
    }

    public static ArrayList<Byte> addRange(byte[] bytes) {
        byte[] var1 = bytes;
        int var2 = bytes.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            byte b = var1[var3];
            byteList.add(b);
        }

        return byteList;
    }

    public static byte[] copyTo(ArrayList<Byte> byteList, int idx) {
        byte[] outbytes = new byte[idx + 1];

        for(int i = 0; i <= idx; ++i) {
            outbytes[i] = (Byte)byteList.get(i);
        }

        return outbytes;
    }

    public static ArrayList<Byte> removeRange(ArrayList<Byte> _byteList, int idx) {
        for(int i = 0; i <= idx; ++i) {
            _byteList.remove(0);
        }

        return byteList;
    }

    public static void clearRange(ArrayList<Byte> _byteList) {
        _byteList.clear();
    }

    public static int getIntegerSomeBit(int _Resource, int _Mask) {
        return _Resource >> _Mask & 1;
    }

    public static boolean getBoolSomeBit(int _Resource, int _Mask) {
        int i = getIntegerSomeBit(_Resource, _Mask);
        return i != 0;
    }

    public static int setIntegerSomeBit(int _Mask, int a, boolean flag) {
        if (flag) {
            a |= 1 << _Mask;
        } else {
            a &= ~(1 << _Mask);
        }

        return a;
    }

    public static CommunicatorStruct getCommunicatorStruct(byte[] uRecBuffer) {
        CommunicatorStruct temp = new CommunicatorStruct();
        temp.setHeader(toHexString2Format(new byte[]{uRecBuffer[0], uRecBuffer[1], uRecBuffer[2]}, ""));
        temp.setLength(toHexString2Format(new byte[]{uRecBuffer[3]}, ""));
        temp.setAddress(toHexString2Format(new byte[]{uRecBuffer[4]}, ""));
        temp.setCmd(toHexString2Format(new byte[]{uRecBuffer[5]}, ""));
        byte[] mybytes = new byte[uRecBuffer.length - 8];

        for(int i = 0; i < mybytes.length; ++i) {
            mybytes[i] = uRecBuffer[6 + i];
        }

        temp.setData(toHexString2Format(mybytes, ""));
        temp.setCrcData(toHexString2Format(new byte[]{uRecBuffer[uRecBuffer.length - 2], uRecBuffer[uRecBuffer.length - 1]}, ""));
        return temp;
    }

    public static DoorCommunicatorStruct getDoorCommunicatorStruct(byte[] uRecBuffer) {
        DoorCommunicatorStruct _temp = new DoorCommunicatorStruct();
        _temp.setHeader(toHexString2Format(new byte[]{uRecBuffer[0], uRecBuffer[1], uRecBuffer[2]}, ""));
        _temp.setLength(toHexString2Format(new byte[]{uRecBuffer[3]}, ""));
        _temp.setRfPositon(toHexString2Format(new byte[]{uRecBuffer[4]}, ""));
        _temp.setCmd(toHexString2Format(new byte[]{uRecBuffer[5]}, ""));
        _temp.setDoorState(toHexString2Format(new byte[]{uRecBuffer[6]}, ""));
        _temp.setAlarmState(toHexString2Format(new byte[]{uRecBuffer[7]}, ""));
        byte[] mybytes = new byte[uRecBuffer.length - 10];

        for(int i = 0; i < mybytes.length; ++i) {
            mybytes[i] = uRecBuffer[8 + i];
        }

        _temp.setData(toHexString2Format(mybytes, ""));
        _temp.setCrcData(toHexString2Format(new byte[]{uRecBuffer[uRecBuffer.length - 2], uRecBuffer[uRecBuffer.length - 1]}, ""));
        return _temp;
    }

    public static String convertUID(String uid) {
        String _uid = "";

        for(int i = 14; i >= 0; i -= 2) {
            _uid = _uid + uid.substring(i, i + 2);
        }

        return _uid;
    }

    public static String convertHalfInt(int i) {
        String my = String.format("%02X", i);
        String h = my.substring(0, 1);
        String l = my.substring(1, 2);
        String sret = String.format("%1$s.%2$s", Integer.parseInt(h, 16), Integer.parseInt(l, 16));
        return sret;
    }

    public static long convertDateTimeToInt(Date time) {
        long epoch = time.getTime() / 1000L;
        return epoch;
    }

    public static int toUnsigned(byte b) {
        return b & 255;
    }

    private static byte[] commSend(byte[] request) {
        int size = 7 + request.length;
        byte[] sendbytes = new byte[size];
        sendbytes[0] = DEFAULT_HEAD[0];
        sendbytes[1] = DEFAULT_HEAD[1];
        sendbytes[2] = DEFAULT_HEAD[2];
        sendbytes[3] = (byte)sendbytes.length;
        sendbytes[4] = (byte)_reader_address;

        for(int i = 0; i < request.length; ++i) {
            sendbytes[5 + i] = request[i];
        }

        byte[] bytes = new byte[size - 2];

        for(int j = 0; j < size - 2; ++j) {
            bytes[j] = sendbytes[j];
        }

        byte[] _bb = Crc16New.cal_crc16(bytes, bytes.length);
        sendbytes[size - 2] = _bb[0];
        sendbytes[size - 1] = _bb[1];
        return sendbytes;
    }

    public static byte[] getSystemInfo() {
        byte[] sendbytes = new byte[]{(byte)EnumRfidCommand.GetSystemInfo.getValue(), 0};
        return commSend(sendbytes);
    }

    public static byte[] inventory() {
        byte[] sendbytes = new byte[]{(byte)EnumRfidCommand.Inventory.getValue(), 0};
        return commSend(sendbytes);
    }

    public static byte[] stayQuiet(String uid) {
        byte[] sendbytes = new byte[10];
        sendbytes[0] = (byte)EnumRfidCommand.StayQuiet.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        return commSend(sendbytes);
    }

    public static byte[] lockBlocks(String uid, int block_id, int blocks) {
        byte[] sendbytes = new byte[12];
        sendbytes[0] = (byte)EnumRfidCommand.LockBlocks.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = (byte)block_id;
        sendbytes[11] = (byte)blocks;
        return commSend(sendbytes);
    }

    public static byte[] readMultipleBlocks(String uid, int block_id, int blocks) {
        byte[] sendbytes = new byte[12];
        sendbytes[0] = (byte)EnumRfidCommand.ReadMultipleBlocks.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = (byte)block_id;
        sendbytes[11] = (byte)blocks;
        return commSend(sendbytes);
    }

    public static byte[] writeMultipleBlocks(String uid, int block_id, ArrayList<String> block_dataList) {
        int blocks = block_dataList.size();
        byte[] sendbytes = new byte[13 + 4 * blocks];
        sendbytes[0] = (byte)EnumRfidCommand.WriteMultipleBlocks.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = (byte)block_id;
        sendbytes[11] = (byte)blocks;
        sendbytes[12] = 4;
        String temp = "";

        String data;
        for(Iterator var7 = block_dataList.iterator(); var7.hasNext(); temp = temp + data) {
            data = (String)var7.next();
        }

        byte[] tempbytes = hexString2Bytes(temp);

        for(int i = 0; i < tempbytes.length; ++i) {
            sendbytes[i + 13] = tempbytes[i];
        }

        return commSend(sendbytes);
    }

    public static byte[] select(String uid) {
        byte[] sendbytes = new byte[10];
        sendbytes[0] = (byte)EnumRfidCommand.Select.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        return commSend(sendbytes);
    }

    public static byte[] resetToReady(String uid) {
        byte[] sendbytes = new byte[10];
        sendbytes[0] = (byte)EnumRfidCommand.ResetToReady.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        return commSend(sendbytes);
    }

    public static byte[] writeAFI(String uid, int afi) {
        byte[] sendbytes = new byte[11];
        sendbytes[0] = (byte)EnumRfidCommand.WriteAFI.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = (byte)afi;
        return commSend(sendbytes);
    }

    public static byte[] writeAFI4Pwd(String uid, byte[] pwd, int afi) {
        byte[] sendbytes = new byte[16];
        sendbytes[0] = (byte)EnumRfidCommand.WriteAFI.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = 16;
        sendbytes[11] = pwd[0];
        sendbytes[12] = pwd[1];
        sendbytes[13] = pwd[2];
        sendbytes[14] = pwd[3];
        sendbytes[15] = (byte)afi;
        return commSend(sendbytes);
    }

    public static byte[] lockAFI(String uid) {
        byte[] sendbytes = new byte[10];
        sendbytes[0] = (byte)EnumRfidCommand.LockAFI.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        return commSend(sendbytes);
    }

    public static byte[] writeDSFID(String uid, int dsfid) {
        byte[] sendbytes = new byte[11];
        sendbytes[0] = (byte)EnumRfidCommand.WriteDSFID.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = (byte)dsfid;
        return commSend(sendbytes);
    }

    public static byte[] lockDSFID(String uid) {
        byte[] sendbytes = new byte[10];
        sendbytes[0] = (byte)EnumRfidCommand.LockDSFID.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        return commSend(sendbytes);
    }

    public static byte[] getTagSystem(String uid) {
        byte[] sendbytes = new byte[10];
        sendbytes[0] = (byte)EnumRfidCommand.GetTagSystem.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        return commSend(sendbytes);
    }

    public static byte[] getMulBlockSecurityStatus(String uid, int block_id, int blocks) {
        byte[] sendbytes = new byte[12];
        sendbytes[0] = (byte)EnumRfidCommand.GetMulBlocksSecurity.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = (byte)block_id;
        sendbytes[11] = (byte)blocks;
        return commSend(sendbytes);
    }

    public static byte[] inventoryMultipleBlocks(int block_id, int blocks) {
        byte[] sendbytes = new byte[]{(byte)EnumRfidCommand.InventoryMultipleBlocks.getValue(), 1, (byte)block_id, (byte)blocks};
        return commSend(sendbytes);
    }

    public static byte[] setEAS(String uid) {
        byte[] sendbytes = new byte[10];
        sendbytes[0] = (byte)EnumRfidCommand.SetEAS.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        return commSend(sendbytes);
    }

    public static byte[] resetEAS(String uid) {
        byte[] sendbytes = new byte[10];
        sendbytes[0] = (byte)EnumRfidCommand.ResetEAS.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        return commSend(sendbytes);
    }

    public static byte[] lockEAS(String uid) {
        byte[] sendbytes = new byte[10];
        sendbytes[0] = (byte)EnumRfidCommand.LockEAS.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        return commSend(sendbytes);
    }

    public static byte[] setEAS4Pwd(String uid, byte[] pwd) {
        byte[] sendbytes = new byte[15];
        sendbytes[0] = (byte)EnumRfidCommand.SetEAS.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = 16;
        sendbytes[11] = pwd[0];
        sendbytes[12] = pwd[1];
        sendbytes[13] = pwd[2];
        sendbytes[14] = pwd[3];
        return commSend(sendbytes);
    }

    public static byte[] resetEAS4Pwd(String uid, byte[] pwd) {
        byte[] sendbytes = new byte[15];
        sendbytes[0] = (byte)EnumRfidCommand.ResetEAS.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = 16;
        sendbytes[11] = pwd[0];
        sendbytes[12] = pwd[1];
        sendbytes[13] = pwd[2];
        sendbytes[14] = pwd[3];
        return commSend(sendbytes);
    }

    public static byte[] lockEAS4Pwd(String uid, byte[] pwd) {
        byte[] sendbytes = new byte[15];
        sendbytes[0] = (byte)EnumRfidCommand.LockEAS.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = 16;
        sendbytes[11] = pwd[0];
        sendbytes[12] = pwd[1];
        sendbytes[13] = pwd[2];
        sendbytes[14] = pwd[3];
        return commSend(sendbytes);
    }

    public static byte[] alarmEAS(String uid) {
        byte[] sendbytes = new byte[10];
        sendbytes[0] = (byte)EnumRfidCommand.AlarmEAS.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        return commSend(sendbytes);
    }

    public static byte[] swOn() {
        byte[] sendbytes = new byte[]{(byte)EnumRfidCommand.SWOn.getValue(), 0};
        return commSend(sendbytes);
    }

    public static byte[] swOff() {
        byte[] sendbytes = new byte[]{(byte)EnumRfidCommand.SWOff.getValue(), 0};
        return commSend(sendbytes);
    }

    public static byte[] pwdProtect(String uid, byte[] pwd, int pdm) {
        byte[] sendbytes = new byte[16];
        sendbytes[0] = (byte)EnumRfidCommand.PwdProtect.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = 16;
        sendbytes[11] = pwd[0];
        sendbytes[12] = pwd[1];
        sendbytes[13] = pwd[2];
        sendbytes[14] = pwd[3];
        sendbytes[15] = (byte)pdm;
        return commSend(sendbytes);
    }

    public static byte[] writePwd(String uid, byte[] old_pwd, byte[] new_pwd) {
        byte[] sendbytes = new byte[19];
        sendbytes[0] = (byte)EnumRfidCommand.WritePwd.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = 16;
        sendbytes[11] = old_pwd[0];
        sendbytes[12] = old_pwd[1];
        sendbytes[13] = old_pwd[2];
        sendbytes[14] = old_pwd[3];
        sendbytes[15] = new_pwd[0];
        sendbytes[16] = new_pwd[1];
        sendbytes[17] = new_pwd[2];
        sendbytes[18] = new_pwd[3];
        return commSend(sendbytes);
    }

    public static byte[] lockPwd(String uid, byte[] pwd) {
        byte[] sendbytes = new byte[15];
        sendbytes[0] = (byte)EnumRfidCommand.PwdProtect.getValue();
        sendbytes[1] = 1;
        byte[] uidbytes = hexString2Bytes(uid);

        for(int i = 0; i < uidbytes.length; ++i) {
            sendbytes[i + 2] = uidbytes[i];
        }

        sendbytes[10] = 16;
        sendbytes[11] = pwd[0];
        sendbytes[12] = pwd[1];
        sendbytes[13] = pwd[2];
        sendbytes[14] = pwd[3];
        return commSend(sendbytes);
    }

    public static byte[] SendReaderCmd(EnumReaderADDL addl, int mode) {
        byte[] sendbytes = new byte[11];
        sendbytes[0] = DEFAULT_HEAD[0];
        sendbytes[1] = DEFAULT_HEAD[1];
        sendbytes[2] = DEFAULT_HEAD[2];
        sendbytes[3] = (byte)sendbytes.length;
        sendbytes[4] = 0;
        sendbytes[5] = (byte)EnumRfidCommand.ReaderCmd.getValue();
        sendbytes[6] = 0;
        sendbytes[7] = (byte)addl.getValue();
        sendbytes[8] = (byte)mode;
        sendbytes[9] = 91;
        sendbytes[10] = -101;
        return sendbytes;
    }

    public static byte[] SetBaudRate(EnumBaudRate baudRate) {
        return SendReaderCmd(EnumReaderADDL.SetBaudRate, (byte)baudRate.getValue());
    }

    public static byte[] SetSlaveId(int id) {
        return SendReaderCmd(EnumReaderADDL.SlaveId, id);
    }

    public static byte[] SetScanMode(EnumScanMode mode) {
        return SendReaderCmd(EnumReaderADDL.ScanMode, (byte)mode.getValue());
    }

    public static byte[] SetBlockId(int block_id) {
        return SendReaderCmd(EnumReaderADDL.ScanBlockId, block_id);
    }

    public static byte[] SetBlockNums(int nums) {
        return SendReaderCmd(EnumReaderADDL.ScanBlockNums, nums);
    }

    public static byte[] SetScanAfi(int afi) {
        return SendReaderCmd(EnumReaderADDL.ScanAfiMode, afi);
    }

    public static byte[] SetBuzzCascade(int value) {
        return SendReaderCmd(EnumReaderADDL.BuzzCascade, value);
    }

    public static byte[] SetRelayCascade(int value) {
        return SendReaderCmd(EnumReaderADDL.RelayCascade, value);
    }

    public static byte[] SetScanTimes(int times) {
        return SendReaderCmd(EnumReaderADDL.ScanTimes, times);
    }

    public static byte[] SetScanReadOnly(boolean value) {
        return SendReaderCmd(EnumReaderADDL.ScanReadOnly, value ? 255 : 0);
    }

    public static byte[] SetScanAsciiMode(boolean value) {
        return SendReaderCmd(EnumReaderADDL.ScanAsciiMode, value ? 1 : 255);
    }

    public static byte[] SetScanEnterMode(int value) {
        return SendReaderCmd(EnumReaderADDL.ScanEnterMode, value);
    }

    public static byte[] GetNoiseLevel() {
        byte[] sendbytes = new byte[]{(byte)EnumRfidCommand.Noise.getValue(), 0};
        return commSend(sendbytes);
    }
}
